-
Notifications
You must be signed in to change notification settings - Fork 25.5k
[Gradle] Configure transitive dependencies via ComponentMetadataRules #134169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Gradle] Configure transitive dependencies via ComponentMetadataRules #134169
Conversation
Pinging @elastic/es-delivery (Team:Delivery) |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
82f2d5f
to
a5d7913
Compare
fcab26f
to
58c5dc5
Compare
testImplementation buildLibs.asm | ||
integTestImplementation buildLibs.asm | ||
api(buildLibs.snakeyaml) | ||
api("org.slf4j:slf4j-api:2.0.6") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as part of this I tried to get rid of some of the 8 slf4j-api dependencies we use in our build by aligning some versions used in the build tools and third party plugins
// Apache Log4j dependencies | ||
// We want to remove log4j-api compile only dependency on biz.aQute.bnd and org.osgi group but | ||
// keep other compile only dependencies like spotbugs, errorprone and jspecify | ||
components.withModule("org.apache.logging.log4j:log4j-api", ExcludeByGroup.class, config -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preparing for #132166
buildscript { | ||
dependencies { | ||
constraints { | ||
classpath "org.slf4j:slf4j-api:2.0.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align slf4j version here so we can get rid of some of the many versions listed in verification metadata
Thanks, this is great. Though, I'm not familiar enough to review the implementation. |
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites.
💔 Backport failed
You can use sqren/backport to manually backport by running |
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…#134169) (#134710) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites.
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites.
…taRules (#134169) (#134714) * [Gradle] Configure transitive dependencies via ComponentMetadataRules (#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle * Fix merge conflicts
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…aRules (#134169) (#134712) * [Gradle] Configure transitive dependencies via ComponentMetadataRules (#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle * Fix merge conflicts * Fix ec2 transitive deps
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle
…taRules (#134169) (#134715) * [Gradle] Configure transitive dependencies via ComponentMetadataRules (#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites. (cherry picked from commit a0e6ea1) # Conflicts: # test/fixtures/url-fixture/build.gradle * Fix merge conflicts * Fix dependencies in 8.18
…elastic#134169) This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level. Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies. The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency. I started looking through the existing dependencies applyging the following pattern: if no problematic transitive dependency detected, do not apply any component meta data rule. if only non group dependencies have been problematic, use ExcludeOtherGroupsTransitiveRule which allows transitive dependencies brought with the same groupId as the parent but excludes all others. Otherwise exclude all transitive dependencies by applying ExcludeAllTransitivesRule We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies. This change replaces our plain transitive = false approach for non elasticsearch dependencies Historically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in weaker control what we bring in and why loose information why a dependency is needed and how its tight ot another dependency on the classpath transitive behavior differed in different context as we only have applied transitivity Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites.
This introduces ComponentMetadataRulesPlugin that contains declarative logic for dealing with transitive dependencies on a per dependency level.
Ulitmately we want more finegrained control over our dependencies without loosing information about transitive dependencies.
The initial list of the applied component metadata rules will be more finegrained over time. Initially this is mostly a reflection of how we brought in dependencies before by basically making the transitive dependencies we identified as required where added as direct dependency.
I started looking through the existing dependencies applyging the following pattern:
ExcludeOtherGroupsTransitiveRule
which allows transitive dependencies brought with the same groupId as the parent but excludes all others.ExcludeAllTransitivesRule
We will add more specific rules in the future as we see the need to "fix' component metadata of thirdparty dependencies.
This change replaces our plain
transitive = false
approach for non elasticsearch dependenciesHistorically we have solved dealing with transitive dependencies and component metadata in this regard by just ignoring it and bringing in dependencies explicitly. This results in
Furthermore the way we have configured transitive = false for each dependency resulted in other problems when using other newer Gradle APIs like test suites.